﻿namespace JanusLibAing.Threading
{
    public interface IExecutionAsync
    {
        /// <summary>
        /// Start execution
        /// </summary>
        void Start();

        /// <summary>
        /// Wait up to thread is finished
        /// </summary>
        /// <param name="timeout">if bigger 0 then waiting is stopped after this time in milliseconds</param>
        void WaitFinishing(int timeout);

        /// <summary>
        /// Close execution async.
        /// It could be wait some time to finishing
        /// </summary>
        void Close();

        /// <summary>
        /// Query to cancel operation
        /// Operation could not be cancelled immediatly
        /// </summary>
        void CancelAsync();

        /// <summary>
        /// Gets a value indicating whether this instance could be executed.
        /// </summary>
        /// <value>
        ///     <c>true</c> if this instance can execute; otherwise, <c>false</c>.
        /// </value>
        bool CanExecute { get; }
    }
}
